function Config() {
	this.version = "0.3";
	this.data = null;
};

Config.prototype.addData = function(data) {
	if (!data) {
		return -1;
	}
	if (!this.data || !this.data.length || !this.data.push) {
		this.data = [];
	}
	this.data.push(data);
	
	return 0;
}

Config.prototype.loadFromDb = function() {
	$(this.data).each(function(index, elem) {
		elem.loadFromDb();
	});
};

Config.prototype.updateView = function() {
	$(this.data).each(function(index, elem) {
		elem.updateView();
	});
};

Config.prototype.getData = function(name) {
	var obj = null;
	if (name) {
		$(this.data).each(function(index, elem) {
			if (elem.getName() != name) {
				return true;
			}
			obj = elem;
			return false; // break;
		});
	} else {
		obj = { };
		$(this.data).each(function(index, elem) {
			obj[elem.getName()] = elem.getData();
		});
	}
	return obj;
};

Config.prototype.setData = function(data) {
	$(this.data).each(function(index, elem) {
		var d = data[elem.getName()];
		console.log(d);
		elem.setData(d);
	});
};
